import jp.sourceforge.qrcode.QRCodeDecoder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;

/**
 * Created by ${chengwengao} on 2017/1/22.
 */
public class ReadQRCode {
    public static void main(String[] args) throws Exception{
        File file = new File("D:/qrcode.png");
        BufferedImage bufferedImage = ImageIO.read(file);
        QRCodeDecoder codeDecoder = new QRCodeDecoder();
        //因为decode方法的参数是QRCodeImage类型的，而QRCodeImage是接口，不能直接实例化，因此此处定义MyQRCodeImage实现该抽象接口
        String result = new String(codeDecoder.decode(new MyQRCodeImage(bufferedImage)),"gb2312");
        System.out.println("解析结果："+result);

    }
}
